﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.Sadharon;

namespace Model.Sohaok
{
    public class Util
    {

        /**
         * setSuccessResult set the success result those are containing only success & message info for both success/failure
         * @param isSuccess e.g. true/false
         * @param message e.g. Added successfully/Failed to add
         * @return return result object
         **/
        public static Result setSuccessResult(Boolean isSuccess, string message)
        {
            Result result = new Result();
            result.IsSuccess = isSuccess;
            result.Message = message;
            return result;
        }


        /**
         * setSuccessResult set the success result those are containing only success & message info for both success/failure
         * @param isSuccess e.g. true/false
         * @param message e.g. Added successfully/Failed to add
         * @param object e.g. suuplier/address object
         * @return return result object
         **/
        public static Result setSuccessResult(Boolean isSuccess, string message, Object obj)
        {
            Result result = new Result();
            result.IsSuccess = isSuccess;
            result.Message = message;
            result.ResultObj = obj;
            return result;
        }


        /**
         * filteredString filtering string to replace unwanted character with appropriate string
         * @param originalString
         * @return filteredString
         **/
        public static string filterString(string originalString)
        {
            string filteredString = "";
            if(!(originalString == null))
                filteredString = originalString.Replace("'", "''");
            return filteredString;
        }

    }
}
